import React from "react";
import './index.scss'

export default class Header extends React.Component {
    handleKey = (event) => {
        const {keyCode, target} = event;
        if (keyCode === 13) {
            this.props.save(target.value)
        }
    }
    render() {
        return (
            <div className="header">
                <input
                    onKeyUp={this.handleKey}
                    type="text"
                    placeholder="请输入任务名称 按回车键结束"
                />
            </div>)
    }
}
